package bbs.controller;

import bbs.model.Post;
import bbs.service.PostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @author ljg;
 * @create 2022-06-08 10:18
 */
@Controller
@RequestMapping("/post")
public class PostController {

    @Autowired
    PostService postService ;

    @RequestMapping("/getPostByTopicId")
    public String getPostByTopicId(@RequestParam("topicId") Integer topicId,
                                   Map<String ,Object> map ){

        List<Post> postByTopicId = postService.getPostByTopicId(topicId);

        map.put("postList", postByTopicId);

        return "post_detail";
    }

}
